function createGetter() {
    return function (data, key, _slef) {
        return Reflect.get(data, key, _slef);
    }
}

function createSetter() {
    return function (data, key, val, _slef) {
        Reflect.set(data, key, val, _slef);
    }
}

function isObject(data) {
    return typeof data === 'object' && data != null;
}

export function createReactive(data) {
    if (!isObject(data)) {
        return data;
    }
    return new Proxy(data, { get: createGetter(), set: createSetter() });
}